<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta name="exporter-version" content="Evernote Mac 9.5.4 (463801)"/><meta name="author" content="704206198@qq.com"/><meta name="created" content="2020-12-15 08:37:23 +0000"/><meta name="source" content="desktop.mac"/><meta name="updated" content="2021-11-09 02:20:30 +0000"/><title>DAY01：JS基本语法</title></head><body><div><span style="font-size: 18px;">第一节：精讲</span></div><div><br/></div><div><span style="font-size: 18px;">1、Javascript基本介绍与发展</span></div><div style="box-sizing: border-box; padding: 8px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902);"><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-weight: bold;">JavaScript能用来做什么？</span></div><div><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    页面分为：</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(255, 38, 0); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">结构、样式、行为</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">。</span></div><div style="text-align: center;"><div><img src="DAY01%EF%BC%9AJS%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95.resources/QQ%E6%88%AA%E5%9B%BE20160530000435.jpg" height="252" width="298"/><br/></div></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    对页面进行渲染，让页面有行为，让页面动起来。</span></div><div><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(4, 51, 255); font-family: Monaco;">            </span><a href="http://www.zcool.com.cn/" style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(4, 51, 255); font-family: Monaco;">http://www.zcool.com.cn/</a></div><div><span style="font-size: 14px; font-family: Monaco;">            动起来不一定专指动画：</span></div><div><span style="font-size: 14px; font-family: Monaco;">            </span><a href="http://www.codingke.com/register" style="font-size: 14px; font-family: Monaco;">http://www.codingke.com/register</a></div><div><br/></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco; font-weight: bold;">JavaScript的历史？</span></div><div><span style="font-size: 14px; font-family: Monaco;">    </span><a href="https://blog.csdn.net/weixin_41636483/article/details/115082019?spm=1001.2014.3001.5501" style="font-family: Monaco;">https://blog.csdn.net/weixin_41636483/article/details/115082019?spm=1001.2014.3001.5501</a></div><div><br/></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco; font-weight: bold;">JavaScript的组成：</span></div><div><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(255, 38, 0); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    ECMAScript、BOM、DOM</span></div><div><br/></div><div><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    ECMAScript是一个</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(255, 38, 0); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">标准</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">，它规定了语法、类型、语句、关键字、保留子、操作符、对象。（相当于法律）</span></div><div style="text-align: center;"><div><img src="DAY01%EF%BC%9AJS%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95.resources/5B037FFA-4492-4B63-95AD-EA81FFF44B17.png" height="211" width="359"/><br/></div></div><div><br/></div><div><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    BOM（</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(255, 38, 0); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">浏览器对象模型</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">）：可以访问浏览器窗口的浏览器对象模型，对浏览器窗口进行操作。</span></div><div style="text-align: center;"><div><img src="DAY01%EF%BC%9AJS%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95.resources/4A9DFE8F-A20E-49AF-AC6D-CC89B55275FB.png" height="155" width="448"/><br/></div></div><div><br/></div><div><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    DOM（</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(255, 38, 0); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">文档对象类型</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">）：DOM把整个页面映射成一个多层节点结构。HTML页面组成都是某种类型的节点，这些节点又包含着不同类型的数据</span></div><div style="text-align: center;"><div><img src="DAY01%EF%BC%9AJS%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95.resources/A9F7AEFE-55C6-4045-8D62-CE3851F6782D.png" height="393" width="390"/><br/></div></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    </span></div><div><br/></div></div><div><br/></div><div><span style="font-size: 18px;">2、Javascript和HTML5的关系</span></div><div style="box-sizing: border-box; padding: 8px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902);"><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    HTML5是一种新的技术，就目前而言，我们所知的HTML5都是一些标签，但是有了JS之后，这些标签深层的扩展功能才得以实现。</span></div><div><br/></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    比如video标签，我们对其理解为一个简单的标签，但实际上，video标签还有更深层次的扩展功能。</span></div><div><br/></div></div><div><br/></div><div><span style="font-size: 18px;">3、如何编写及运行JS</span></div><div style="box-sizing: border-box; padding: 8px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902);"><div><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    JS也是一种脚本语言，他可以有两种方式在HTML页面进行引入，</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(255, 38, 0); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">一种是外联，一种是内部</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">。</span></div><div><br/></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">   </span> <span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-weight: bold;">外联JS的写法为：</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">        &lt;script src="相对路径"&gt;&lt;/script&gt;</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">        这是一条html语句，原则上可以放在html页面的任意位置，不用和link标签一样非得放在head部分</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">        相对路径链接的是JavaScript文件，文件的扩展名为.js，如index.js</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    </span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">   </span> <span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-weight: bold;">内部JS的写法为：</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">        &lt;script&gt;</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">            //在script标签内写js脚本</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">        &lt;/script&gt;</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    </span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(255, 38, 0); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">   </span> <span style="background-color: rgb(251, 250, 248); font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(255, 147, 0); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">错误的写法：</span></span></div><div><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(255, 147, 0); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    </span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(255, 147, 0); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    </span><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(255, 147, 0); font-family: Monaco;">&lt;script src="相对路径"&gt;</span></span></div><div><font face="Monaco" style="font-size: 14px;" color="#ff9300"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(255, 147, 0); font-family: Monaco;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(255, 147, 0); font-family: Monaco;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(255, 147, 0); font-family: Monaco;">    //在script标签内写js脚本</span></font></div><div><font face="Monaco" style="font-size: 14px;" color="#ff9300"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(255, 147, 0); font-family: Monaco;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(255, 147, 0); font-family: Monaco;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(255, 147, 0); font-family: Monaco;">&lt;/script&gt;</span></font></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    =============================================================================</span></span></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><span style="font-size: 14px; font-family: Monaco;">如何将信息呈现给用户：</span></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">   </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco;"> 1.</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51); font-weight: bold;">向页面中打印内容：</span></font></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">        document.write(“这是一些文本内容”);</span></span></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    可以直接解析标签：</span></span></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">        document.write(“&lt;strong&gt;加粗的内容&lt;/strong&gt;”);</span></span></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">   </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51); font-weight: bold;">转义字符：</span></font></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">        &amp;lt;  ====  &lt;</span></span></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">        &amp;gt;  ====  &gt;</span></span></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">        document.write(“&amp;lt;strong&amp;gt;这是一些加粗的内容&lt;/strong&gt;”);</span></span></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">2.将信息打印到浏览器的控制台</span></span></div><div><span style="background-color: rgb(251, 250, 248);"><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(255, 38, 0);">console.log("hello world")</span></font></span></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    跟document.write()使用方式类似，但是不能解析标签</span></span></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">3.弹出框显示信息</span></span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">   </span><span style="font-size: 14px; font-family: Monaco;" /><span style="background-color: rgb(251, 250, 248);"><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(255, 38, 0); font-family: Monaco;">alert()方法</span></span></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    alert()方法可以弹出()里面的内容，</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">同时可以停止浏览器加载代码</span></font></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    浏览器解析代码的顺序（从上到下，从左到右）</span></span></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    只能以字符的形式显示信息，非自付会被强行转成字符</span></span></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><span style="font-size: 18px; font-family: Monaco;">4、变量的概念及基本运算</span></div><div style="box-sizing: border-box; padding: 8px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902);"><div style="text-align: center;"><div><font face="Monaco" style="font-size: 14px;"><img src="DAY01%EF%BC%9AJS%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95.resources/6B27CD4F-ED2C-4446-8BD2-E2FCD8C76A3C.png" height="371" width="464"/><br/></font></div></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    他叫</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(255, 38, 0);">汤姆</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">，他是一只</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(255, 38, 0);">猫</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">。</span></font></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">   </span><span style="font-size: 14px; font-family: Monaco;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">猫由什么组成？</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco;">猫皮，猫肉，猫爪，</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">比起</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">吃</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">老鼠更愿意玩老鼠的心，每次整老鼠反而被整的笨脑子。</span></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    它的主人每次叫它什么？那个批了张猫皮，长着猫肉，有猫爪.....的什么玩意，你过来一下...</span></span></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    不！我们叫它</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(255, 38, 0);">汤姆</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">！这是这只猫的</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(255, 38, 0);">名字</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">！</span></font></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    在计算机中，我们把这只猫塞进一个汤姆的名字内。这个“汤姆”，就是一个</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(255, 38, 0);">变量</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">。</span></font></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">   </span><span style="font-size: 14px; font-family: Monaco;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco; font-weight: bold;">如何创建一个变量？</span></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    var tom = “猫”;</span></span></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">var a = “</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">&lt;strong&gt;加粗的内容&lt;/strong&gt;</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">”;</span></font></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">   </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(255, 38, 0);">var是一个关键字，用来声明一个变量；</span></font></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    ＝  表示赋值（取名字）；</span></span></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    声明变量以“＝”为区分，左边为变量名（被赋值），右边为存放进变量中的内容（给变量赋值）。</span></span></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">   </span><span style="font-size: 14px; font-family: Monaco;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(255, 38, 0); font-family: Monaco;">注意：JS中的“＝”号，和数学中的“＝”不一样，在JS中“＝”的作用是赋值（取名字）</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">。</span></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    </span></span></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    var 声明变量的底层原理：我们所写的程序运行在内存中，当我们使用关键字var 声明一个变量的时候，计算机会从内存中划分一个空间，为我们存放不同类型的内容做准备。</span></span></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);"> </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);"> </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);"> </span></font></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">   </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51); font-weight: bold;">变量的类型（数据类型）</span></font></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">        因为存放在变量中的数据是放在计算机的内存中的，计算机只识别0和1，所以需要对不同类型的数据进行转义，转义的结果会导致所需空间不同，所以JS中分成很多种数据类型，以便计算机储存时使用。</span></span></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);"> </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco;">   </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(255, 38, 0);">数值类型（number）</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">：1234567890</span></font></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(255, 38, 0);">字符类型（string）</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">："123"  'asd'  "文字"   "数据"（被单引号或双引号，包裹的部分，引号必须配套使用）</span></font></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">   </span><span style="font-size: 14px; font-family: Monaco;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(255, 38, 0); font-family: Monaco;">定义了未赋值类型（undefined）</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">：这是一种特殊类型，当变量被声明，但是没有被赋值的时候，那么该变量的类型的undefined</span></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">   </span><span style="font-size: 14px; font-family: Monaco;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(255, 38, 0); font-family: Monaco;">布尔值类型（boolean）</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">：true，false  （真，假）</span></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    </span></span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">   </span><span style="font-size: 14px; font-family: Monaco;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(255, 38, 0); font-family: Monaco;">对象类型（object）</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">：{}object</span></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">   </span><span style="font-size: 14px; font-family: Monaco;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(255, 38, 0); font-family: Monaco;">数组类型（array）</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">：[]</span></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    如何区分或得知不同的数据类型：</span></span></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    通过</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(255, 38, 0);">关键字  typeof 变量名</span></font></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    小技巧：声明一串变量时可以这么写，var a=1,b=2,c=3;(但是不推荐初学者这么用，因为这样的声明方式会导致注释不明确)</span></span></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div></div><div><br/></div><div><span style="font-size: 18px;">5、变量命名规则和关键字的介绍</span></div><div style="box-sizing: border-box; padding: 8px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902);"><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    变量的名字 就像 人的名字一样，不能乱起。</span></span></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    </span></span></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    你的代码不是只有你一个人看，变量既然是名字，那就这个名字就要有特殊的意义：</span></span></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    举个栗子：</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(255, 38, 0);">翠花</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">，我们能从这个名字中得到什么信息？（这个名字应该是个女的，父母应该希望她长得跟花一样，一个美好的愿景）</span></font></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">           小钢炮？</span></span></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    我们能从名字中读出很多含义，是因为我们的语言常识，同样，变量也有一套类似的常识标准，代表了各种含义，如下：</span></span></div><div style="text-align: center;"><div><font face="Monaco" style="font-size: 14px;"><img src="DAY01%EF%BC%9AJS%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95.resources/E4FE7042-8353-4ECF-8944-5CF699C3154F.png" height="206" width="420"/><br/></font></div></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    也就是</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51); font-weight: bold;">第一个规则：</span></font></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">       </span><span style="font-size: 14px; font-family: Monaco;"> 语义化，</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(255, 38, 0); font-family: Monaco;">前缀就能表示出这个变量的类型</span></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">   </span><span style="font-size: 14px; font-family: Monaco;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco; font-weight: bold;">第二个规则：</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">       </span><span style="font-size: 14px; font-family: Monaco;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(255, 38, 0); font-family: Monaco;">开头必须为字母或者$或者_</span></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    那么能不能使用typeof做为变量名呢？想都别想！</span></span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">   </span><span style="font-size: 14px; font-family: Monaco;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco; font-weight: bold;">第三个规则：</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">       </span><span style="font-size: 14px; font-family: Monaco;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(255, 38, 0); font-family: Monaco;">关键字和保留字不能用做变量名。</span></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">   </span><span style="font-size: 14px; font-family: Monaco;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco; font-weight: bold;">关键字：</span></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">        以下这些关键字用于执行特定操作等。按照规则，关键字也是语言保留的，不能用做标识符。</span></span></div><table style="border-collapse: collapse; min-width: 100%;"><colgroup><col style="width: 165px;"/><col style="width: 151px;"/><col style="width: 159px;"/><col style="width: 152px;"/></colgroup><tbody><tr><td style="border: 1px solid rgb(204, 204, 204); width: 165px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">break</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 151px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">do</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 159px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">instanceof</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 152px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">typeof</span></span></div></td></tr><tr><td style="border: 1px solid rgb(204, 204, 204); width: 165px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">case</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 151px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">else</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 159px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">new</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 152px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">var</span></span></div></td></tr><tr><td style="border: 1px solid rgb(204, 204, 204); width: 165px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">catch</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 151px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">finally</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 159px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">return</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 152px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">void</span></span></div></td></tr><tr><td style="border: 1px solid rgb(204, 204, 204); width: 165px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">continue</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 151px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">for</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 159px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">switch</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 152px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">while</span></span></div></td></tr><tr><td style="border: 1px solid rgb(204, 204, 204); width: 165px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">debugger*</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 151px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">function</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 159px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">this</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 152px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">with</span></span></div></td></tr><tr><td style="border: 1px solid rgb(204, 204, 204); width: 165px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">default</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 151px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">if</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 159px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">throw</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 152px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">delete</span></span></div></td></tr><tr><td style="border: 1px solid rgb(204, 204, 204); width: 165px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">in</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 151px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">try</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 159px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;"> </span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 152px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;"> </span></span></div></td></tr></tbody></table><div style="text-align: center;"><div style="text-align: left;"><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);"> </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">   </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51); font-weight: bold;">保留字：</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">未来可能做为关键字的存在</span></font></div></div><table style="border-collapse: collapse; min-width: 100%;"><colgroup><col style="width: 165px;"/><col style="width: 152px;"/><col style="width: 157px;"/><col style="width: 154px;"/></colgroup><tbody><tr><td style="border: 1px solid rgb(204, 204, 204); width: 165px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">abstract</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 152px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">enum</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 157px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">int</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 154px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">short</span></span></div></td></tr><tr><td style="border: 1px solid rgb(204, 204, 204); width: 165px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">boolean</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 152px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">export</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 157px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">interface</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 154px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">static</span></span></div></td></tr><tr><td style="border: 1px solid rgb(204, 204, 204); width: 165px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">byte</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 152px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">extends</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 157px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">long</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 154px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">super</span></span></div></td></tr><tr><td style="border: 1px solid rgb(204, 204, 204); width: 165px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">char</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 152px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">final</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 157px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">native</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 154px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">synchronized</span></span></div></td></tr><tr><td style="border: 1px solid rgb(204, 204, 204); width: 165px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">class</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 152px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">float</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 157px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">package</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 154px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">throws</span></span></div></td></tr><tr><td style="border: 1px solid rgb(204, 204, 204); width: 165px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">const</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 152px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">goto</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 157px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">private</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 154px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">transient</span></span></div></td></tr><tr><td style="border: 1px solid rgb(204, 204, 204); width: 165px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">debugger</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 152px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">implements</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 157px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">protected</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 154px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">volatile</span></span></div></td></tr><tr><td style="border: 1px solid rgb(204, 204, 204); width: 165px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">double</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 152px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">import</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 157px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">public</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 154px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;"> </span></span></div></td></tr></tbody></table><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">  </span></span></div></div><div><br/></div><div><span style="font-size: 18px; font-family: Monaco;">6、算术、赋值、关系运算符的讲解</span></div><div style="box-sizing: border-box; padding: 8px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902);"><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    JS中的运算符分为：</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(255, 38, 0);">算术／赋值／关系／逻辑／自增自减</span></font></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(255, 38, 0); font-weight: bold;">算术运算符：</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">  </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">+加法</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">-减法</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">*乘法</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">/除法</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">%取余</span></font></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">        var a = 1, b = 2;</span></span></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    a + b = 3</span></font></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">   </span><span style="font-size: 14px; font-family: Monaco;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">a - b = -1</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">   </span><span style="font-size: 14px; font-family: Monaco;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">a * b = 2</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">   </span><span style="font-size: 14px; font-family: Monaco;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">a / b = 0.5</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">   </span><span style="font-size: 14px; font-family: Monaco;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">a % b = 1</span></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    目测，跟数学中的运算符是一样的。但是：</span></span></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">   </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">var a = "1", b = "2";</span></font></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    a * b = 2</span></font></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    a / b = 0.5</span></font></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    a - b = -1</span></font></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">   </span><span style="font-size: 14px; font-family: Monaco;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(255, 0, 0); font-family: Monaco;">a + b = ???</span></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco;">   </span><span style="font-size: 14px; font-family: Monaco;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco;">+号，有两层意思，第一层算数之间的加法；第二层字符串的连接；执行过程中，先检测加号两边的数据类型，如果发现字符型，那就先 生效字符的连接</span></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco;">        数据类型转换：强制转换、隐式转换</span></span></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    其实还是有点不一样：和我们概念中的逻辑运算符很多都是不一样的：</span></span></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">        比如：  =    ==    ===</span></span></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    </span></span></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    并且不同数据类型之间的运算得到的结果，可能不是我们意想中的；</span></span></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    有什么差别呢？</span></span></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    </span></span></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    </span></span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">   </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    </span><span style="font-size: 14px; font-family: Monaco;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(255, 38, 0); font-family: Monaco; font-weight: bold;">赋值运算符：</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">  =</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    +=</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    -=</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    *=</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    /=</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    %=</span></div><table style="border-collapse: collapse; min-width: 100%;"><colgroup><col style="width: 136px;"/><col style="width: 136px;"/><col style="width: 132px;"/><col style="width: 126px;"/></colgroup><tbody><tr><td style="text-align: left; background-color: rgb(243, 243, 243); border: 1px solid rgb(227, 227, 227); width: 136px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(243, 243, 243);"><span style="background-color: rgb(243, 243, 243); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">运算符</span></span></div></td><td style="text-align: left; background-color: rgb(243, 243, 243); border: 1px solid rgb(227, 227, 227); width: 136px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(243, 243, 243);"><span style="background-color: rgb(243, 243, 243); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">例子</span></span></div></td><td style="text-align: left; background-color: rgb(243, 243, 243); border: 1px solid rgb(227, 227, 227); width: 132px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(243, 243, 243);"><span style="background-color: rgb(243, 243, 243); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">等价于</span></span></div></td><td style="text-align: left; background-color: rgb(243, 243, 243); border: 1px solid rgb(227, 227, 227); width: 126px; padding: 8px;"><div style="text-align: center;background-color:rgb(255, 255, 255);"><span style="background-color: rgb(243, 243, 243);"><span style="background-color: rgb(243, 243, 243); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">运算结果</span></span></div></td></tr><tr><td style="border: 1px solid rgb(204, 204, 204); width: 136px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">=</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 136px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">y = 6</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 132px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">y = 6</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 126px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">y = 6</span></span></div></td></tr><tr><td style="border: 1px solid rgb(204, 204, 204); width: 136px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">+=</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 136px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">y += 1</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 132px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">y = y+1</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 126px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">y = 7</span></span></div></td></tr><tr><td style="border: 1px solid rgb(204, 204, 204); width: 136px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">-=</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 136px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">y -= 1</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 132px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">y = y-1</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 126px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">y = 5</span></span></div></td></tr><tr><td style="border: 1px solid rgb(204, 204, 204); width: 136px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">*=</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 136px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">y *= 2</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 132px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">y = y*2</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 126px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">y = 12</span></span></div></td></tr><tr><td style="border: 1px solid rgb(204, 204, 204); width: 136px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">/=</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 136px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">y /= 2</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 132px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">y = y/2</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 126px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">y = 3</span></span></div></td></tr><tr><td style="border: 1px solid rgb(204, 204, 204); width: 136px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">%=</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 136px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">y %= 4</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 132px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">y = y%4</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 126px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">y = 2 </span></span></div></td></tr></tbody></table><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><font face="Monaco" style="font-size: 14px;"><br style="color: rgb(51, 51, 51);"/></font></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">   </span><span style="font-size: 14px; font-family: Monaco;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(255, 38, 0); font-family: Monaco; font-weight: bold;">关系运算符：</span><span style="font-size: 14px; font-family: Monaco;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;"> &lt;</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    &lt;=</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    &gt;</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">     &gt;=</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    ==</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    !=</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    ===</span></div><table style="border-collapse: collapse; min-width: 100%;"><colgroup><col style="width: 136px;"/><col style="width: 154px;"/><col style="width: 136px;"/><col style="width: 104px;"/></colgroup><tbody><tr><td style="text-align: left; background-color: rgb(243, 243, 243); border: 1px solid rgb(227, 227, 227); width: 136px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(243, 243, 243);"><span style="background-color: rgb(243, 243, 243); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">运算符</span></span></div></td><td style="text-align: left; background-color: rgb(243, 243, 243); border: 1px solid rgb(227, 227, 227); width: 154px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(243, 243, 243);"><span style="background-color: rgb(243, 243, 243); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">说明</span></span></div></td><td style="text-align: left; background-color: rgb(243, 243, 243); border: 1px solid rgb(227, 227, 227); width: 136px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(243, 243, 243);"><span style="background-color: rgb(243, 243, 243); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">例子</span></span></div></td><td style="text-align: left; background-color: rgb(243, 243, 243); border: 1px solid rgb(227, 227, 227); width: 104px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(243, 243, 243);"><span style="background-color: rgb(243, 243, 243); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">运算结果</span></span></div></td></tr><tr><td style="border: 1px solid rgb(204, 204, 204); width: 136px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">==</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 154px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">等于</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 136px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">2 == 3</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 104px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">false</span></span></div></td></tr><tr><td style="border: 1px solid rgb(204, 204, 204); width: 136px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">===</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 154px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">恒等于（值和类型都要做比较）</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 136px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">2 === 2</span></span></div><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">2 === "2"</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 104px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">true</span></span></div><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">false</span></span></div></td></tr><tr><td style="border: 1px solid rgb(204, 204, 204); width: 136px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">!=</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 154px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">不等于</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 136px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">2 != 3</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 104px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">true</span></span></div></td></tr><tr><td style="border: 1px solid rgb(204, 204, 204); width: 136px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">&gt;</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 154px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">大于</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 136px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">2 &gt; 3</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 104px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">false</span></span></div></td></tr><tr><td style="border: 1px solid rgb(204, 204, 204); width: 136px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">&lt;</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 154px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">小于</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 136px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">2 &lt; 3</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 104px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">true</span></span></div></td></tr><tr><td style="border: 1px solid rgb(204, 204, 204); width: 136px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">&gt;=</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 154px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">大于等于</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 136px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">2 &gt;= 3</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 104px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">false</span></span></div></td></tr><tr><td style="border: 1px solid rgb(204, 204, 204); width: 136px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">&lt;=</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 154px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">小于等于</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 136px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">2 &lt;= 3</span></span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 104px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: Monaco;">true</span></span></div></td></tr></tbody></table><div><font face="Monaco" style="font-size: 14px;"><br/></font></div></div><div><br/></div><div><span style="font-size: 18px; font-family: &quot;Helvetica Neue&quot;;">7、编程习惯</span></div><div style="box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.15);-en-codeblock:true;"><div><font style="font-size: 18px;"><font face="Monaco">     <font color="#ff2600">语句结束要加分号</font>，虽然不加分号在JS语法上没有什么问题，但是建议不要省略分号，加了分号之后可以使用软件压缩。</font></font></div><div><font style="font-size: 18px;"><span style="font-family: Monaco;">    这是一种良好的编程习惯（JavaScript权威指南）。</span></font></div></div><div><br/></div><div><br/></div><div><span style="font-size: 18px; font-family: &quot;Helvetica Neue&quot;;">第二节：应用</span></div><div><span style="font-size: 18px; font-family: &quot;Helvetica Neue&quot;;">1.为抵抗洪水，战士连续作战</span><span style="font-size: 18px; font-family: &quot;Helvetica Neue&quot;;">89</span><span style="font-size: 18px; font-family: &quot;Helvetica Neue&quot;;">小时，编程计算共多少天零多少小时？</span></div><div><br/></div><div><span style="font-size: 18px; font-family: &quot;Helvetica Neue&quot;;">2.小明要到美国旅游，可是那里的温度是以华氏度为单位记录的。</span></div><div><span style="font-size: 18px; font-family: &quot;Helvetica Neue&quot;;">它需要一个程序将华氏温度（</span><span style="font-size: 18px; font-family: &quot;Helvetica Neue&quot;;">80</span><span style="font-size: 18px; font-family: &quot;Helvetica Neue&quot;;">度）转换为摄氏度，并以华氏度和摄氏度为单位分别显示该温度。</span></div><div><span style="font-size: 18px; font-family: &quot;Helvetica Neue&quot;;">提示：摄</span><span style="font-size: 18px; font-family: &quot;Helvetica Neue&quot;;">氏度与华氏度的转换公式为：摄氏度</span> <span style="font-size: 18px; font-family: &quot;Helvetica Neue&quot;;">= 5/9.0*(</span><span style="font-size: 18px; font-family: &quot;Helvetica Neue&quot;;">华氏度</span><span style="font-size: 18px; font-family: &quot;Helvetica Neue&quot;;">-32)     // </span><span style="font-size: 18px; font-family: &quot;Helvetica Neue&quot;;">保留</span><span style="font-size: 18px; font-family: &quot;Helvetica Neue&quot;;">3</span><span style="font-size: 18px; font-family: &quot;Helvetica Neue&quot;;">位小数。</span></div><div><br/></div><div><br/></div><div><br/></div><div><br/></div><div><span style="font-size: 18px;">第三节：精讲</span></div><div><br/></div><div><span style="font-size: 18px;">1、变量不同类型之间的自动、手动类型转换</span></div><div style="box-sizing: border-box; padding: 8px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902);"><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    我们想做数学运算的时候，应该先对所有的数据类型进行统一（统一成数字格式），这个时候我们就该用到数据类型的转换。</span></span></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    var a=3,b="10",c=true;</span></font></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    alert(a+b);</span></font></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    alert(b+c);</span></font></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    alert(a+c);</span></font></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    运算结果好像并不是我们想要的。</span></span></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">   </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51); font-weight: bold;">转换成字符型：</span></font></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(255, 38, 0); font-family: Monaco;">        toString()</span></span></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">            </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">var num = 123;</span></font></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">            num</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(255, 38, 0);">.toString();转换成字符串</span></font></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(255, 38, 0);">            </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(255, 38, 0);">将num从数值型变成字符型</span></font></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(255, 38, 0); font-family: Monaco;">        toFixed()</span></span></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(255, 38, 0);">            </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">var num = 123.456;</span></font></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">        </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    num</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(255, 38, 0);">.toFixed(n);转换成字符串的同时保留n位小数</span></font></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">   </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco;"> </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; font-weight: bold;">拓展：</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51); font-weight: bold;">浮点数：</span></font></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    电脑在运算过程中以正确的二进制浮点进行运算，但是我们输入的都是十进制的数，这两者并不是总是能转化的那么准确，有时候会得到正确的结果，但有时候就没那么幸运。</span></font></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    alert(0.7+0.1);???</span></font></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    alert(</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">0.6+0.2);???</span></font></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51); font-weight: bold;">转换成数值：</span></font></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">   </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(255, 38, 0);"> </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(255, 38, 0);">parseInt();转换成整数，可以接受两个值</span></font></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(255, 38, 0);">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(255, 38, 0);">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(255, 38, 0);">parseFloat();转换成浮点数</span></font></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">   </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51); font-weight: bold;">两者的不同：</span></font></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    parseInt();该方法从左向右，检测数字或字符串，当第一次发现一个不为数字的字符时，把之前的所有进行返回，如果字符串中第一个就不是数字，那么返回NaN</span></font></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    例如：parseInt("123</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(255, 38, 0);">a</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">bc");a做为第一个不是数字的字符；返回a之前的所有值，则该方法返回123</span></font></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);"> parseInt("</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(255, 38, 0);">a</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">bc123");a做为第一个不是数字的字符，且处在字符串的第一位，则判定该字符串无法转换为数字返回NaN</span></font></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    parseFloat();该方法检索数字或字符串后面第一个.后的不为数字的字符，并对之前所有的结果进行返回，如果第一个字符不为数字，那么返回NaN</span></font></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    例如：parseFloat(“123.456");返回123.456</span></font></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">     parseFloat(“123.4</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(255, 38, 0);">a</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">56");返回123.4</span></font></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">     parseFloat(“123.00");返回123</span></font></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">     parseFloat(“123.0</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(255, 38, 0);">a</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">56");返回123</span></font></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    想想为什么？</span></font></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    关于浮点数：</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(255, 38, 0);">Math.round()四舍五入</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">取整浮点数。</span></font></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(255, 38, 0);">认识NaN：它是一种特殊的Number类型，代表意外转换的数字，NaN和任何东西都不相等，包括它自己。</span></font></div><div style="text-align: left;"><font face="Monaco" style="font-size: 14px;"><br/></font></div></div><div><br/></div><div><span style="font-size: 18px;">2.逻辑运算</span></div><div style="box-sizing: border-box; padding: 8px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902);"><div><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;"> </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">   一门计算机语言，编程的核心在于逻辑思想，当我们在编写程序的时候，逻辑是否通顺，是能否写出程序的关键，可以说如果掌握了逻辑，那么你就踏入的计算机编程的大门。</span></div><div><br/></div><div><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    </span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    </span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(255, 38, 0); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">逻辑运算符：</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">  &amp;&amp;</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    ||</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    !</span></div><table style="border-collapse: collapse; min-width: 100%;"><colgroup><col style="width: 81px;"/><col style="width: 161px;"/><col style="width: 122px;"/><col style="width: 137px;"/></colgroup><tbody><tr><td style="text-align: left; background-color: rgb(243, 243, 243); border: 1px solid rgb(227, 227, 227); width: 81px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(243, 243, 243); font-size: 14px; color: rgb(0, 0, 0); font-family: tahoma, arial, 宋体;">运算符</span></div></td><td style="text-align: left; background-color: rgb(243, 243, 243); border: 1px solid rgb(227, 227, 227); width: 161px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(243, 243, 243); font-size: 14px; color: rgb(0, 0, 0); font-family: tahoma, arial, 宋体;">说明</span></div></td><td style="text-align: left; background-color: rgb(243, 243, 243); border: 1px solid rgb(227, 227, 227); width: 122px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(243, 243, 243); font-size: 14px; color: rgb(0, 0, 0); font-family: tahoma, arial, 宋体;">例子</span></div></td><td style="text-align: left; background-color: rgb(243, 243, 243); border: 1px solid rgb(227, 227, 227); width: 137px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(243, 243, 243); font-size: 14px; color: rgb(0, 0, 0); font-family: tahoma, arial, 宋体;">运算结果</span></div></td></tr><tr><td style="border: 1px solid rgb(204, 204, 204); width: 81px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: tahoma, arial, 宋体;">&amp;&amp;</span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 161px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: tahoma, arial, 宋体;">逻辑与（and）</span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 122px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: tahoma, arial, 宋体;">x = 2;</span></div><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: tahoma, arial, 宋体;">y = 6;</span></div><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: tahoma, arial, 宋体;">x&gt;5 &amp;&amp; y&gt;5</span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 137px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: tahoma, arial, 宋体;">FALSE</span></div></td></tr><tr><td style="border: 1px solid rgb(204, 204, 204); width: 81px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: tahoma, arial, 宋体;">||</span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 161px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: tahoma, arial, 宋体;">逻辑或（or）</span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 122px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: tahoma, arial, 宋体;">x = 2;</span></div><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: tahoma, arial, 宋体;">y = 6;</span></div><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: tahoma, arial, 宋体;">x&gt;5 || y&gt;5</span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 137px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: tahoma, arial, 宋体;">TRUE</span></div></td></tr><tr><td style="border: 1px solid rgb(204, 204, 204); width: 81px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: tahoma, arial, 宋体;">!</span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 161px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: tahoma, arial, 宋体;">逻辑非，取逻辑的反面</span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 122px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: tahoma, arial, 宋体;">x = 2;</span></div><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: tahoma, arial, 宋体;">y = 6;</span></div><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: tahoma, arial, 宋体;">!(x &gt; y)</span></div></td><td style="border: 1px solid rgb(204, 204, 204); width: 137px; padding: 8px;"><div style="background-color:rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255); font-size: 14px; color: rgb(0, 0, 0); font-family: tahoma, arial, 宋体;">TRUE</span></div></td></tr></tbody></table><div><br/></div></div><div><br/></div><div><span style="font-size: 18px;">3.自增自减运算</span></div><div style="box-sizing: border-box; padding: 8px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902);"><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">   </span><span style="font-size: 14px; font-family: Monaco;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(255, 38, 0); font-family: Monaco;">++        --</span></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    a++表示在a原有的基础上增加1</span></span></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    a--表示在a原有的基础上减小1</span></span></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">    那么，</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">+</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">+a  和  --</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">a  呢?</span></font></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    var a = 1;</span></span></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    alert(a);</span></span></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    var b = 1;</span></span></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    alert(b++);</span></span></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">        alert(b);</span></span></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    var c = 1;</span></span></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    alert(++c);</span></span></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    前自增与后自增有本质的区别，他们相同点都是为自身加了1，不同点是</span></span></div><div><font face="Monaco" style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(51, 51, 51);">        </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco; color: rgb(255, 38, 0);">前自增是先加1，再使用操作数的值</span></font></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(255, 38, 0); font-family: Monaco;">        后自增是先使用操作数的值，再加1</span></span></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco;">    前自减和后自减同上。</span></span></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div><div><font face="Monaco" style="font-size: 14px;"><br/></font></div></div><div><br/></div><div><span style="font-size: 18px;">4.NaN的概念和应用</span></div><div style="box-sizing: border-box; padding: 8px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902);"><div><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(255, 38, 0); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">NaN</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(255, 38, 0); font-family: Monaco;">：是一种特殊的Number类型，代表意外转换的数字，NaN和任何东西都不相等。厉害到自己都不等于自己</span></div><div><br/></div><div style="text-align: center;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">not a number不是一个数字的数值</span></div><div style="text-align: center;"><div><img src="DAY01%EF%BC%9AJS%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95.resources/017FF087-730F-4416-ADC7-25AD83FE170B.png" height="424" width="550"/><br/></div><div><br/></div><div style="text-align: left;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    alert(NaN == NaN);返回false</span></div><div style="text-align: left;"><div><br/></div></div><div style="text-align: left;"><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    var a = 0;</span></div></div><div style="text-align: left;"><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    var b;</span></div></div><div style="text-align: left;"><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    var c = a + b;</span></div></div><div style="text-align: left;"><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    alert(c);</span></div></div><div style="text-align: left;"><div><br/></div></div><div style="text-align: left;"><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    认识</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(255, 38, 0); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">isNaN()函数，该函数判断括号内的值是否是NaN，是就返回true，不是就返回false</span></div></div><div style="text-align: left;"><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    alert(isNaN(c));</span></div></div></div><div style="font-size: 12px;"><br/></div></div><div><br/></div><div><span style="font-size: 18px;">5.Number方法的应用</span></div><div style="box-sizing: border-box; padding: 8px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902);"><div><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    </span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(255, 38, 0); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">Number()为严格数据类型转换</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">：</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    </span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    Number("hello world");    //NaN</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    Number("123456");         //123456</span></div><div><br/></div></div><div><br/></div><div><br/></div><div><br/></div><div><span style="font-size: 18px;">第四节：应用</span></div><div><span style="font-size: 18px;">1. 计算两个文本框的和</span></div><div><span style="font-size: 18px; color: unset; font-family: unset;">    计算两个文本框的</span><span style="font-size: 14pt; background-color: rgb(255, 255, 204); color: rgb(8, 8, 8); font-family: consolas;">差</span></div><div><span style="font-size: 18px;">    计算两个文本框的</span><span style="font-size: 14pt; background-color: rgb(255, 255, 204); color: rgb(8, 8, 8); font-family: consolas;">积</span></div><div><span style="font-size: 18px;">    计算两个文本框的商</span></div><div><br/></div><div><br/></div><div><span style="font-size: 18px;">2. </span><span style="font-size: 18px; font-family: 微软雅黑;">var k=10;</span></div><div><span style="font-size: 18px; font-family: 微软雅黑;">    var sum = </span><span style="font-size: 18px; font-family: 微软雅黑;">k++ + ++k +k +k++;</span></div><div><span style="font-size: 18px;">    console.log</span><span style="font-size: 18px; font-family: 微软雅黑;">(k);</span></div><div><span style="font-size: 18px;">    console.log</span><span style="font-size: 18px; font-family: 微软雅黑;">(sum);</span></div><div><br/></div><div><span style="font-size: 18px; font-family: 微软雅黑;">3.掌握逻辑运算的意义</span></div><div><br/></div><div><span style="font-size: 18px; font-family: 微软雅黑;">4.掌握</span><span style="font-size: 18px; font-family: 微软雅黑;">NaN</span><span style="font-size: 18px; font-family: 微软雅黑;">的含义</span></div><div><br/></div><div><span style="font-size: 18px; font-family: 微软雅黑;">5.掌握</span><span style="font-size: 18px; font-family: 微软雅黑;">Number</span><span style="font-size: 18px; font-family: 微软雅黑;">函数的转换结果</span></div><div><br/></div><div><br/></div><div><br/></div><div><span style="font-size: 18px;">第五节：综合应用</span></div><div><span style="font-size: 18px;">1.计算两个文本框的加减乘除</span></div><div><span style="font-size: 18px;">    要求：1.使用parseInt方法类型转换</span></div><div><span style="font-size: 18px;">               2.计算结果是用Math.round方法四舍五入</span></div><div><br/></div><div><span style="font-size: 18px;">2.计算一个半径为80cm的圆的面积。打印到页面上。</span></div><div><span style="font-size: 18px;">pai * r * r</span></div><div><br/></div><div><span style="font-size: 18px;">        3.1415</span></div><div><span style="font-size: 18px;"><br/></span></div><div><span style="font-size: 18px;">圆的周长</span></div><div><span style="font-size: 18px;">2 * pai * r</span></div><div><br/></div><div><span style="font-size: 18px;">3.角度转弧度，公式</span></div><div><span style="font-size: 18px;">jiao = 180 / pai * hu</span></div><div><span style="font-size: 18px;"><br/></span></div><div><span style="font-size: 18px;"><br/></span></div><div><br/></div><div><br/></div></body></html>